import java.security.MessageDigest;
import sun.misc.BASE64Encoder;

//hex -> byte
public class MD5Test {

 public static String hexToBytes(String s) {
   		 StringBuffer buf = new StringBuffer();
    	
    	byte[] b = new byte[s.length() / 2];
    	
    	for(int i = 0; i < s.length() / 2; i++) {
			String ss = s.substring(i*2, (i*2)+2);
			b[i] = (byte)((Byte.parseByte(ss.substring(0, 1), 16) << 4) | Byte.parseByte(ss.substring(1, 2), 16));

       }
    	
	   String defstr = new String(b); 
    	return defstr;
  }
  
  

	public static void main(String[] args) throws Exception {
		
		String imsi = hexToBytes(args[0]);
		
		BASE64Encoder b64e   = new BASE64Encoder();
        String strConvertPWD = b64e.encode(imsi.getBytes());
		
		System.out.println(strConvertPWD);
		
		
	}
}

